package com.daoImpl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Component;

import com.dao.TrainDao;
import com.model.InviteJob;
import com.model.Train;

@Component("TrainDao")
public class TrainDaoImpl implements TrainDao{

	private HibernateTemplate hibernateTemplate;
	public void addTrain(Train train) {
		this.hibernateTemplate.save(train);
	}

	public void deleteTrain(Train train) {
		this.hibernateTemplate.delete(train);
	}

	public Train getTrain(int id) {
		return (Train)this.hibernateTemplate.get(Train.class,id);
	}

	public List<Train> getTrainList(String hql) {
		List<Train> trainList=hibernateTemplate.find("from Train");
		return trainList;
	}

	public void updateTrain(Train train) {
		this.hibernateTemplate.update(train);
	}

	public HibernateTemplate getHibernateTemplate() {
		return hibernateTemplate;
	}
	@Resource
	public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
		this.hibernateTemplate = hibernateTemplate;
	}

	
}
